package com.sumover.POJO;

import java.io.Serializable;
import java.util.Date;
import java.util.Objects;

public class News extends Article implements Serializable {
    private Integer aid;

    private String title;

    private Date newsDate;

    private static final long serialVersionUID = 1L;

    public Integer getAid() {
        return aid;
    }

    public void setAid(Integer aid) {
        this.aid = aid;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title == null ? null : title.trim();
    }

    public Date getNewsDate() {
        return newsDate;
    }

    public void setNewsDate(Date newsDate) {
        this.newsDate = newsDate;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        if (!super.equals(o)) return false;
        News news = (News) o;
        return Objects.equals(aid, news.aid) &&
                Objects.equals(title, news.title) &&
                Objects.equals(newsDate, news.newsDate);
    }

    @Override
    public int hashCode() {
        return Objects.hash(super.hashCode(), aid, title, newsDate);
    }

    @Override
    public String toString() {
        return "News{" +
                "aid=" + aid +
                ", title='" + title + '\'' +
                ", newsDate=" + newsDate +
                '}';
    }
}